package com.handa.admin.userservice.controller;


import com.handa.admin.userservice.common.entity.Response;
import com.handa.admin.userservice.entity.DO.SysRoleDO;
import com.handa.admin.userservice.entity.VO.SysRoleVO;
import com.handa.admin.userservice.service.ISysRoleService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 角色表 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-05-21
 */
@RestController
@RequestMapping("/Admin/sys-role")
public class SysRoleController {

    @Autowired
    private ISysRoleService sysRoleService;


    @GetMapping("/queryAll")
    private Response<List<SysRoleVO>> getRoleList() {
        List<SysRoleVO> res = new ArrayList<>();
        List<SysRoleDO> list = sysRoleService.list();
        for (SysRoleDO sysRoleDO : list) {
            SysRoleVO item = new SysRoleVO();
            BeanUtils.copyProperties(sysRoleDO, item);
            res.add(item);
        }
        return Response.success(res);
    }

}

